﻿// Decompiled with JetBrains decompiler
// Type: MCM.LightInject.LazyHelper
// Assembly: MCMv5, Version=5.10.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 7AB326B9-B2B4-41C2-9177-68E944071101
// Assembly location: D:\steam\steamapps\workshop\content\261550\2859238197\bin\Win64_Shipping_Client\MCMv5.dll

using System;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;

#nullable disable
namespace MCM.LightInject
{
  [ExcludeFromCodeCoverage]
  internal static class LazyHelper
  {
    public static readonly MethodInfo CreateScopedLazyMethod = typeof (LazyHelper).GetTypeInfo().GetDeclaredMethod("CreateScopedLazy");
    public static readonly MethodInfo CreateScopedLazyFromDelegateMethod = typeof (LazyHelper).GetTypeInfo().GetDeclaredMethod("CreateScopedLazyFromDelegate");

    public static Lazy<T> CreateScopedLazy<T>(ServiceContainer serviceContainer, Scope scope)
    {
      return new Lazy<T>((Func<T>) (() => (T) serviceContainer.GetInstance(typeof (T), scope)));
    }

    public static Lazy<T> CreateScopedLazyFromDelegate<T>(
      GetInstanceDelegate getInstanceDelegate,
      object[] constants,
      Scope scope)
    {
      return new Lazy<T>((Func<T>) (() => (T) getInstanceDelegate(constants, scope)));
    }
  }
}
